using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Money.Interface;
using FRW.Common;
using FRW.Common.Configuration;

namespace Money
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            PathManager pm = PathManager.Instance;
            MoneyDoc doc;
            MainForm mainForm;

            string fileName = null;

            Cursor.Current = Cursors.WaitCursor;

            pm.SetType(ApplicationInstallType.USER);

            // TODO expand the crude checking of arguments
            if (args.Length == 1)
            {
                    fileName = args[0];
            }

            doc = new MoneyDoc();
            mainForm = new MainForm(doc);
            doc.SetGuiInterface(mainForm);

            if (!String.IsNullOrWhiteSpace(fileName))
            {
                doc.Open(fileName);
            }

            Cursor.Current = Cursors.Default;

            Application.Run(mainForm);
        }
    }
}